<?php  $categories = $this->requestAction('/categories/menu_seccion/'.$seccion);?>

<ul id="nav" class="dropdown dropdown-vertical">
<?php
foreach($categories as $category):
    $children = $this->requestAction('/categories/countChildren/'.$category['Category']['id']);
    if( !$children ):?>
    <li><?php echo $category['Category']['name']; ?></li>

<?php else:?>
     <li>
         <?php echo $category['Category']['name'] ?>
         <ul>
                <?php $subcats = $this->requestAction('/categories/subcats/'.$category['Category']['id']);
                foreach($subcats as $subcat): ?>
                <li><?php echo $html->link($subcat['Category']['name'],array('controller'=>'products','action'=>'ver_categoria',$subcat['Category']['slug'])); ?></li>
               <?php endforeach;?>

         </ul>
     </li>
<?php
    endif;
    endforeach;
 ?>
</ul>

